package cn.dengta.webapp.ai.model;

import java.util.Arrays;
import javax.annotation.Nullable;

import cn.dengta.common.model.ValueProxy;
import cn.dengta.context.model.*;
import lombok.Getter;

@Getter
public enum AiStatus implements LabelI18nProxy<AiStatus, Integer> {
	/** 审核不通过 */
	VERIFY_FALSE(-9, ImEnumI18nKey.AI_STATUS_VERIFY_FALSE, true),
	/** 平台冻结下线 */
	FREEZE(-1, ImEnumI18nKey.AI_STATUS_OFFLINE, true),
	/** 待审核 */
	WAIT_VERIFY(0, ImEnumI18nKey.AI_STATUS_WAIT_VERIFY, true),
	/** 审核通过 */
	PASS(1, ImEnumI18nKey.AI_STATUS_PASS, true),
	//
	;

	public final Integer value;
	public final boolean show;
	public final ValueProxy<AiStatus, Integer> proxy;

	AiStatus(Integer value, String label, boolean show) {
		this.value = value;
		this.show = show;
		this.proxy = new ValueProxy<>(this, value, label);
	}

	public static boolean available(@Nullable Integer status) {
		return status != null && status >= AiStatus.PASS.value;
	}

	public static AiStatus[] CACHE = Arrays.stream(values()).filter(AiStatus::isShow).toArray(AiStatus[]::new);

	public static AiStatus[] getValues() {
		return ValueProxy.getCachedArray(AiStatus.class, AiStatus::values);
	}

	public static AiStatus of(Integer value) {
		return PASS.getValueOf(value);
	}

}
